//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Globalization;
using System.Windows.Data;

namespace OpenLS.Chart.UI
{

    class ShapePropertiesObserverFactory: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return null;
            if (value is BarChartBase)
                return new ShapePropertiesObserver<BarSeries>(((BarChartBase)value).Series);
            if (value is AreaChartBase)
                return new ShapePropertiesObserver<AreaSeries>(((AreaChartBase)value).Series);
            if (value is LineChartBase)
                return new ShapePropertiesObserver<LineSeries>(((LineChartBase)value).Series);
            throw new NotSupportedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
